<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

//支持get|post传参
Route::group(['namespace'=>'App\Http\Controllers\Api'],function(){
    //登录
    Route::any('/login', 'LoginController@login');
    //业务层
    Route::group(['middleware'=>['token']],function () {
        //为访问的client用户进行加时操作
        Route::any('/', 'Controller@addExpire');
        //逻辑处理层(用户逻辑层)
        Route::group(['prefix'=>'/User'],function () {
            Route::any('/getUser', 'UserController@getUser');
        });
//        Route::group(['prefix'=>'/Home'],function () {
//            Route::get('/index', 'HomeController@index');
//        });
    });
});
